import React, { Component } from 'react'

export default class Dialog extends Component {
    state = {
        userInfo: {
            name: "",
            age: 0,
            // sex: false
        }
    }
    render() {
        const { fn, fn2 } = this.props
        const { userInfo } = this.state
        const { name, age, sex } = userInfo
        return (
            <div className="dialog h100">
                <div className="mark">
                    <p>
                        姓名: <input value = { name } onChange = {(ev) => {
                            let userInfo = { ...this.state.userInfo }
                            userInfo.name = ev.target.value
                            this.setState({
                                userInfo
                            })
                        }} type="text" />
                    </p>
                    <p>
                        年龄: <input value = { age } onChange = {(ev) => {
                            let userInfo = { ...this.state.userInfo }
                            userInfo.age = ev.target.value
                            this.setState({
                                userInfo
                            })
                        }}   type="number" />
                    </p>
                    {/* <p>
                        性别:  --
                        男：<input name="sex" type="radio" />
                        女：<input name="sex" type="radio" />
                    </p> */}

                    <button onClick = {() => {
                        fn2(false, this.state.userInfo)
                    }}>确定</button>

                    <button onClick = {() => {
                        fn(false)
                    }}>取消</button>
                </div>
            </div>
        )
    }
}
